import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { CompetitionCodeVO, CompetitionCodeForm, CompetitionCodeQuery } from '@/api/system/competitionCode/types';

/**
 * 查询竞赛单号列表
 * @param query
 * @returns {*}
 */

export const listCompetitionCode = (query?: CompetitionCodeQuery): AxiosPromise<CompetitionCodeVO[]> => {
  return request({
    url: '/system/competitionCode/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询竞赛单号详细
 * @param id
 */
export const getCompetitionCode = (id: string | number): AxiosPromise<CompetitionCodeVO> => {
  return request({
    url: '/system/competitionCode/' + id,
    method: 'get'
  });
};

/**
 * 新增竞赛单号
 * @param data
 */
export const addCompetitionCode = (data: CompetitionCodeForm) => {
  return request({
    url: '/system/competitionCode',
    method: 'post',
    data: data
  });
};

/**
 * 修改竞赛单号
 * @param data
 */
export const updateCompetitionCode = (data: CompetitionCodeForm) => {
  return request({
    url: '/system/competitionCode',
    method: 'put',
    data: data
  });
};

/**
 * 删除竞赛单号
 * @param id
 */
export const delCompetitionCode = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/competitionCode/' + id,
    method: 'delete'
  });
};
